<template>
	<view class="container">
		<view class="panel-header padding-top solid-bottom">
			<view class="g-goBack" @click="$utils.toBack()">
				<view class="cuIcon-back"></view>
			</view>
			<view class="text-cut">【分成收益】{{tradeNo}}</view>
		</view>
		<view class="list-body">
			<view class="cu-card article" v-for="(item,index) in listData" :key="index">
				<view class="cu-item padding-top-xs">
					<view @click="toOrderInfo(item)">
						<view class="title">
							<view class="text-cut text-orange">姓名：{{item.userName}}</view>
						</view>
						<view class="content">
							<view class="text-cut">
								<view><text class="tt">角色类型：</text>{{item.roleTypeName}}</view>
								<view><text class="tt">分成比例：</text>{{item.incomeRatio}}%</view>
								<view><text class="tt">分成金额：</text>{{item.moneyStr}}元</view>
								<view><text class="tt">创建时间：</text>{{item.createDate}}</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="foot" v-if="listData && listData.length > 0"><text class="ftxt">我也是有底线的</text></view>
		<view class="foot" v-else><text class="ftxt">暂无数据</text></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tradeNo:null,
				createDate:null,
				listData:[]
			};
		},
		onLoad(option) {
			this.tradeNo = option.tradeNo;
			this.createDate = option.createDate;
			this._loadListData();
		},
		methods:{
			_loadListData:function(){
				if(this.tradeNo){
					const _self = this;
					const api = this.$request;
					api.post(api.url.orderProfitList,{
						tradeNo:this.tradeNo,
						createDate:this.createDate
					},(res)=>{
						console.log(res)
						if(res.code==200){
							_self.listData = res.body.items;
						}else if(res.code == 202){
							//不做任何事
						}else if(res.msg){
							uni.showModal({
								content:res.msg,
								showCancel:false
							})
						}else{
							uni.showToast({
								title:'获取数据失败',
								icon:'error'
							})
						}
					})
				}
			}
		}
	}
</script>

<style lang="less">
.list-body .cu-card>.cu-item{position:relative;margin-bottom:0;}
.list-body .cu-card>.cu-item .title{line-height:60rpx;}
.list-body .cu-card>.cu-item .content{font-size:26rpx;}
.list-body .cu-card>.cu-item .content .tt{min-width:130rpx;display:inline-block;text-align:right;}
</style>
